<layout name="mun" />
<div class="operation_user clearfix">
    <div class="link fl"><a href="#">商城</a><span>&gt;&gt;</span><a href="#">商品管理</a><span>&gt;&gt;</span>修改商品</div>
    <div class="link fr">
        <a href="#" class="icon icon_i">首页</a><span></span>欢迎您！<span>Admin</span><a href="#" class="icon icon_e">退出</a>
    </div>
</div>
<div class="content clearfix">
    <div class="main">
        <!--右侧内容-->
        <div class="cont">
            <div class="title">修改商品</div>
            <div class="details">
                <div class="formDiv">
                    <div class="form-group">
                        <label for="userName" class="col-sm-2 control-label"></label>
                        <div class="col-sm-10">

                          <a> 商品名称</a>
                            <input type="text" class="form-control"  id="pName" value="{$rs[0]['pname']}"/>
                           <a>所属分类</a>
                            <input type="text" class="form-control"  id="cId" value="{$rs[0]['cid']}"/>
                            <a>商品货号</a>
                            <input type="text" class="form-control"  id="pSn" value="{$rs[0]['psn']}"/>
                           <a> 商品库存<a/>
                            <input type="text" class="form-control"  id="pNum" value="{$rs[0]['pnum']}"/>
                           <a>市场价</a>
                            <input type="text" class="form-control"  id="mPrice" value="{$rs[0]['mprice']}"/>
                            <a>网站价</a>
                            <input type="text" class="form-control"  id="iPrice" value="{$rs[0]['iprice']}"/>
                            <a>商品简介</a>
                            <input type="text" class="form-control"  id="pDesc" value="{$rs[0]['pdesc']}"/>

                           <a>商品图片</a>
                               <br>
                               &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                               <td><a href="{:U('Lommodity/Img?id='.$rs[0][\"id\"])}">查看图片</a></td>
                            <br>
                            <a>商品上架时间</a>
                            <input type="text" class="form-control"  id="pubTime" value="{$rs[0]['pubtime']}"/>
                            <a>商品是否上架</a>
                            <select name="isShow" class="form-control" id="isShow">
                                <if condition="$rs[0]['isshow'] eq 0 ">
                                    <option value="0">否</option>
                                    <option value="1">是</option>
                                    <else />
                                        <option value="1">是</option>
                                        <option value="0">否</option>
                                </if>
                            </select>

                           <a>商品是否热卖</a>
                            <select name="isShow" class="form-control" id="isHot">
                                <if condition="$rs[0]['ishot'] eq 0 ">
                                    <option value="0">否</option>
                                    <option value="1">是</option>
                                    <else />
                                    <option value="1">是</option>
                                    <option value="0">否</option>
                                </if>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-sm-offset-2 col-sm-10">
                            <button id="xiugai" value="{$rs[0]['id']}"  class="btn btn-primary">提交</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <SCRIPT src="__JS__jquery-1.9.1.min.js" type="text/javascript"></SCRIPT>
    <script type="text/javascript">
        $(function(){
            $('#xiugai').click(function(){
                if($("#pName").val() != ""){
                $.post("{:U('Lommodity/doXiugai')}",{
                    id:$("#xiugai").val(),
                    pName:$("#pName").val(),
                    cId:$("#cId").val(),
                    pSn:$("#pSn").val(),
                    pNum:$("#pNum").val(),
                    mPrice:$("#mPrice").val(),
                    iPrice:$("#iPrice").val(),
                    pDesc:$("#pDesc").val(),
                    pImg:$("#pImg").val(),
                    pubTime:$("#pubTime").val(),
                    isShow:$("#isShow").val(),
                    isHot:$("#isHot").val()
                },function(data){

                    if(data.status == 0){
                        alert(data.info);
                    }else{
                        alert(data.info);
                        location.href=data.url;
                    }
                });
            }else{
                    alert("不能为空");
                }
            });
        });
    </script>
